package guoanmaker.operator.business.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import guoanmaker.operator.business.model.PatentQueryRecord;

public interface PatentQueryRecordRepository extends JpaRepository<PatentQueryRecord, String>, JpaSpecificationExecutor<PatentQueryRecord> {
	
/*	@Query("select p from PatentQueryRecord p where p.title=:title")
	List<PatentQueryRecordRo> aa(@Param("title")String title);*/
	
	/*@Query("select p.idp.user.id,p.keyWrod,p.queryDate,p.title,p.kind,p.times from PatentQueryRecord p where p.user.id=:user_id and p.keyWord=:keyWord")*/
	@Query(nativeQuery=true,value="SELECT  p.id,p.user_id,p.key_word,p.query_date,p.title,p.kind FROM t_operator_patentqueryrecord p LEFT JOIN t_personal_user u ON  p.user_id=u.id WHERE  p.key_word=:keyword and u.id=:userid")
	List<PatentQueryRecord> findByUserIdAndKeyWrod(@Param("keyword")String keyword,@Param("userid")String userid);
	
}
